<?php 
/**
* 栏目delete
*/
define('ACC', true);
require('../include/init.php');
//用户检查
if (empty($_SESSION['username'])) {
	header("location:../index.php");
}

$cat_id = isset($_GET['cat_id'])?$_GET['cat_id']+0:'';
/**
*连接数据库
*/
$cat = new CatModel();

//print_r($cat);

$art = new ArtModel();
//print_r($art);

if($art->getArtCount($cat_id) !=0){
	$info = '栏目下有文章，不允许删除';
	include(ROOT.'view/admin/info.html');
	exit;
}


if (!$cat->delete($cat_id)) {
	$info = '删除失败';
	include(ROOT.'view/admin/info.html');
	exit;
}else{
	$info = '删除成功';
	include(ROOT.'view/admin/info.html');
}






?>